package com.easy.utils.domain;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;

/**
 * 班级
 *
 * @author TPF
 * @since 2024/8/28
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ClassRoom {

    // 班级id
    private Integer classId;
    // 班级名称
    private String className;

    /**
     * 模拟数据库中查询数据
     */
    public static List<ClassRoom> getClassRoomData(Collection<Object> classIds) {
        List<ClassRoom> list = new ArrayList<>();
        list.add(new ClassRoom(1, "移动一班"));
        list.add(new ClassRoom(2, "移动二班"));
        list.add(new ClassRoom(3, "金融一班"));
        list.add(new ClassRoom(4, "嵌入一班"));
        list.add(new ClassRoom(5, "计算机科学"));
        List<ClassRoom> collect = list.stream()
                .filter(room -> classIds.contains(room.getClassId()))
                .collect(Collectors.toList());
        return collect;
    }

}
